
//2900.最长相邻不相等子序列I
class Solution {
public:
    vector<string> getLongestSubsequence(vector<string>& words, vector<int>& groups) {
        int n=words.size();
        int i=0;
        vector<string> ret;  //记录结果
        while(i<n)
        {
            int start=i;  //记录起始位置
            while(i<n&&groups[i]==groups[start]) i++; 
            ret.push_back(words[start]);
        }   
        return ret;
    }
};